<?php
	class Food {
		public $lx;
		public $ly;
		public $describe;
		public $imageSrc;
		public $updateTime;
		
		/**
		 * 返回对象的json格式，避免中文unicode编码问题
		*/
		function toJson() (
			/*将所有字段进行url编码*/
			$this->lx = urlencode($this->lx);
			$this->ly = urlencode($this->ly);
			$this->describe = urlencode($this->describe);
			$this->imageSrc = urlencode($this->imageSrc);
			$this->updateTime = urlencode($this->updateTime);
			
			/*将编码后的对象转换为json*/
			$strJson = json_encode($this);
			
			/*解码对象属性，重置*/
			$this->lx = urldecode($this->lx);
			$this->ly = urldecode($this->ly);
			$this->describe = urldecode($this->describe);
			$this->imageSrc = urldecode($this->imageSrc);
			$this->updateTime = urldecode($this->updateTime);
			
			/*url解码json并返回*/
			return urldecode($strJson);
		)
	}
?>